<!DOCTYPE html>
<html>
	<head>
		<title>{:lang('一级好友')}</title>
        <include file="appapi@head"/>
		<link href='__STATIC__/appapi/css/agent_profit.css' rel="stylesheet" type="text/css" >
	</head>
    <body >

	<div class="profit">
		<ul>
			<volist name="list" id="v">
			<li>
				<img class="thumb" src="{$v['userinfo']['avatar']}">
				<div class="info">
					<p class="name">{$v['userinfo']['user_nickname']}</p>
					<p class="id">ID: {$v['userinfo']['id']}</p>
				</div>
				<div class="info2">
					<p class="icon"><img src="__STATIC__/appapi/images/coin.png" class="votes"></p>
					<p class="coin">{$v['coin']}</p>
				</div>
			</li>
			</volist>
            <empty name="list">
            <div class="empty"></div>
            </empty>
		</ul>
	</div>
	
	<include file="appapi@footer"/>
    <include file="appapi@scripts"/>
    <script>
        var uid='{$uid}';
        var token='{$token}';
     	$(function(){
            function getlistmore(){
                $.ajax({
                    url:'/appapi/agent/one_more',
                    data:{'page':page,'uid':uid,'token':token},
                    type:'post',
                    dataType:'json',
                    success:function(data){
                        if(data.nums>0){
                            var nums=data.nums;
                            var list=data.list.data;
                            var html='';
                            for(var i=0;i<nums;i++){
                                var v=list[i];
                                html+='<li>\
                                    <img class="thumb" src="'+v['userinfo']['avatar']+'">\
                                    <div class="info">\
                                        <p class="name">'+v['userinfo']['user_nickname']+'</p>\
                                        <p class="id">ID: '+v['userinfo']['id']+'</p>\
                                    </div>\
                                    <div class="info2">\
                                        <p class="icon"><img src="__STATIC__/appapi/images/coin.png" class="votes"></p>\
                                        <p class="coin">'+v['coin']+'</p>\
                                    </div>\
                                </li>';
                            }
                            
                            $(".list ul").append(html);
                        }
                        
                        if(data.isscroll==1){
                            page++;
                            isscroll=true;
                        }
                    }
                })
            }
            

            var page=2; 
            var isscroll=true; 

            var scroll_obj=$(window);
            scroll_obj.scroll(function(){  
                    var srollPos = scroll_obj.scrollTop();    //滚动条距顶部距离(页面超出窗口的高度)  		
                    var totalheight = parseFloat(scroll_obj.height()) + parseFloat(srollPos);  
                    if(($(document).height()-50) <= totalheight  && isscroll) {  
                            isscroll=false;
                            getlistmore()
                    }  
            });  


        })
     </script>
</body>
</html>